/*
 * JBoss, Home of Professional Open Source
 *
 * Distributable under LGPL license.
 * See terms of license at gnu.org.
 */
package org.jboss.seam.wiki.core.action.prefs;

import java.io.Serializable;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

import org.hibernate.validator.constraints.Length;
import org.jboss.seam.wiki.preferences.PreferenceVisibility;
import org.jboss.seam.wiki.preferences.annotations.PreferenceProperty;
import org.jboss.seam.wiki.preferences.annotations.Preferences;
import org.springframework.stereotype.Component;

@Preferences(name = "Wiki", description = "#{messages['lacewiki.preferences.wiki.Name']}")
@Component("Wiki")
public class WikiPreferences implements Serializable {

	private static final long serialVersionUID = -2881065538737995624L;

    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.ThemeName']}",
        visibility = PreferenceVisibility.SYSTEM,
        editorIncludeName = "SelectOne",
        templateComponentName = "themePreferenceValueTemplate"
    )
    @Length(min = 3, max = 255)
    @NotNull
    private String themeName;

    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.RenderPermLinks']}",
        visibility = PreferenceVisibility.SYSTEM
    )
    private Boolean renderPermlinks;

    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.PermLinkSuffix']}",
        visibility = PreferenceVisibility.SYSTEM,
        editorIncludeName = "AdaptiveTextInput"
    )
    @Length(min = 2, max = 10)
    @Pattern(regexp="\\.[a-zA-z]+")
    @NotNull
    private String permlinkSuffix;

    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.AtSymbolReplacement']}",
        visibility = PreferenceVisibility.SYSTEM,
        editorIncludeName = "AdaptiveTextInput"
    )
    @Length(min = 1, max = 20)
    @NotNull
    private String atSymbolReplacement;
    
    @NotNull
    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.defaultBusinessUnitId']}",
        visibility = PreferenceVisibility.SYSTEM
    )
	private Long defaultBusinessUnitId;

    @NotNull
    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.defaultTemplateId']}",
        visibility = PreferenceVisibility.SYSTEM
    )
	private Long defaultTemplateId;

    @NotNull
    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.adminImgFileDirectory']}",
        visibility = PreferenceVisibility.SYSTEM
    )
	private String adminAppImgFileDirectory;
    
    @NotNull
    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.webAppImgFileDirectory']}",
        visibility = PreferenceVisibility.SYSTEM
    )
	private String webAppImgFileDirectory;

    @NotNull
    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.adminImgHttpBasePath']}",
        visibility = PreferenceVisibility.SYSTEM
    )
	private String adminImgHttpBasePath;

    @NotNull
    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.webAppImgHttpBasePath']}",
        visibility = PreferenceVisibility.SYSTEM
    )
	private String webAppImgHttpBasePath;
    
    @NotNull
    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.defaultSiteInode']}",
        visibility = PreferenceVisibility.SYSTEM
    )
    private Long defaultSiteInode;
    @NotNull
    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.webAppNoImgHttpPath']}",
        visibility = PreferenceVisibility.SYSTEM
    )
	private String webAppNoImgHttpPath;//前台无图片默认显示

    @NotNull
    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.webAppNoImgHttpPath']}",
        visibility = PreferenceVisibility.SYSTEM
    )
	private String htmlPageFileDest;
    
    @NotNull
    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.templateFileDest']}",
        visibility = PreferenceVisibility.SYSTEM
    )
	private String templateFileDest;

    @PreferenceProperty(
        description = "#{messages['lacewiki.preferences.wiki.enableClickTracking']}",
        visibility = PreferenceVisibility.SYSTEM
    )
	private Boolean enableClickTracking;

	public String getThemeName() {
		return themeName;
	}

	public Boolean getRenderPermlinks() {
		return renderPermlinks;
	}

	public String getPermlinkSuffix() {
		return permlinkSuffix;
	}

	public String getAtSymbolReplacement() {
		return atSymbolReplacement;
	}

	public Long getDefaultBusinessUnitId() {
		return defaultBusinessUnitId;
	}

	public Long getDefaultTemplateId() {
		return defaultTemplateId;
	}

	public String getAdminAppImgFileDirectory() {
		return adminAppImgFileDirectory;
	}

	public String getWebAppImgFileDirectory() {
		return webAppImgFileDirectory;
	}

	public String getAdminImgHttpBasePath() {
		return adminImgHttpBasePath;
	}

	public String getWebAppImgHttpBasePath() {
		return webAppImgHttpBasePath;
	}

	public String getWebAppNoImgHttpPath() {
		return webAppNoImgHttpPath;
	}

	public String getHtmlPageFileDest() {
		return htmlPageFileDest;
	}

	public String getTemplateFileDest() {
		return templateFileDest;
	}

	public Long getDefaultSiteInode() {
		return defaultSiteInode;
	}

	public Boolean getEnableClickTracking() {
		return enableClickTracking;
	}

}
